package com.sky.sd.system.bean.dto;

import lombok.Builder;
import lombok.Data;
import lombok.ToString;

import java.util.List;

/**
 * <br/>功能:
 * <br/>版本: 1.0
 * <br/>开发人员: 弓振
 * <br/>创建日期: 2020/7/3 10:46
 * <br/>修改日期: 2020/7/3 10:46
 * <br/>修改列表:
 */
@Data
@Builder
@ToString(callSuper = true)
public class BasicPairNode implements Comparable<BasicPairNode>{

    private String id;
    private String value;
    private String label;
    private String code;
    private String parentId;
    private Integer enabled;
    private Integer sort;
    private Integer leaf;// 是否是叶子节点，1是，0不是
    private List<BasicPairNode> children;

    @Override
    public int compareTo(BasicPairNode o) {
        if(sort == null) {
            return 1;
        } else if(o.getSort() == null) {
            return -1;
        } else {
            return sort - o.getSort();
        }
    }
}
